package com.my.zidingyikongjian.view.one;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

/**
 * 项目名称：单条直线控件
 * 创建人：mwb
 * 创建时间：2018/6/28 9:24
 */

public class SingleLineView extends View {

    public SingleLineView(Context context) {
        super(context);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint(); // 新建画笔
        paint.setColor(Color.GREEN);// 画笔颜色
        paint.setStrokeWidth(5); // 画笔大小
        paint.setStyle(Paint.Style.FILL); // 画笔填充样式

        // 画布
//        Canvas canvas1 = new Canvas();
        canvas.drawRGB(255, 255, 255);
        canvas.drawLine(100, 100, 200, 200, paint);
    }
}
